import time

file1 = open("m1_sorted")
s = file1.readlines()
A = [int(i) for i in s]
t_start = time.time()
for i in range(len(A)-1):
    for j in range(len(A) - 2, i - 1, -1):
        if A[j + 1] < A[j]:
            A[j], A[j + 1] = A[j + 1], A[j]        
t_finish = time.time()
print("m1_sorted", round((t_finish - t_start) * 1000), "milliseconds")

file1 = open("m2_reverse")
s = file1.readlines()
A = [int(i) for i in s]
t_start = time.time()
for v in range(len(A)-1):
    for p in range(len(A) - 2, v - 1, -1):
        if A[p + 1] < A[p]:
            A[p], A[p + 1] = A[p + 1], A[p]        
t_finish = time.time()
print("m2_reverse", round((t_finish - t_start) * 1000), "milliseconds")

file1 = open("m3_shuffle")
s = file1.readlines()
A = [int(i) for i in s]
t_start = time.time()
for x in range(len(A)-1):
    for y in range(len(A) - 2, x - 1, -1):
        if A[y + 1] < A[y]:
            A[y], A[y + 1] = A[y + 1], A[y]        
t_finish = time.time()
print("m3_shuffle", round((t_finish - t_start) * 1000), "milliseconds")
